using Godot;
using Godot.Collections;

namespace Arcane.Source.Client.Extensions;

public static class GdArrayExt
{
    public static Variant Car(this Array arr)
    {
        return arr[0];
    }

    public static T Car<[MustBeVariant] T>(this Array arr)
    {
        return arr[0].As<T>();
    }

    public static Array Cdr(this Array arr)
    {
        arr.RemoveAt(0);
        return arr;
    }

    public static Array Cddr(this Array arr)
    {
        arr.RemoveAt(0);
        arr.RemoveAt(0);
        return arr;
    }
}